package com.neusoft.myDemo.controller;

import com.neusoft.myDemo.entity.User;
import com.neusoft.myDemo.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

@RestController
public class UserController {

    @Autowired
    private UserService userService;


    @RequestMapping("/userList")
    public Map<String, Object> userList(HttpServletRequest request, User user){
        return userService.userMapList(request, user);

    }

    @RequestMapping("/saveUser")
    public int userDetail(@RequestBody User user){
        return  userService.addAndUpdataUsers(user);
    }



}
